
<h1><span class="yiyi-st" id="yiyi-12">numpy.array_str</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.array_str.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.array_str.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="function">
<dt id="numpy.array_str"><span class="yiyi-st" id="yiyi-13"> <code class="descclassname">numpy.</code><code class="descname">array_str</code><span class="sig-paren">(</span><em>a</em>, <em>max_line_width=None</em>, <em>precision=None</em>, <em>suppress_small=None</em><span class="sig-paren">)</span><a class="reference external" href="http://github.com/numpy/numpy/blob/v1.11.3/numpy/core/numeric.py#L1835-L1869"><span class="viewcode-link">[source]</span></a></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-14">返回数组中数据的字符串表示形式。</span></p>
<p><span class="yiyi-st" id="yiyi-15">数组中的数据作为单个字符串返回。</span><span class="yiyi-st" id="yiyi-16">此函数类似于<a class="reference internal" href="numpy.array_repr.html#numpy.array_repr" title="numpy.array_repr"><code class="xref py py-obj docutils literal"><span class="pre">array_repr</span></code></a>，区别在于<a class="reference internal" href="numpy.array_repr.html#numpy.array_repr" title="numpy.array_repr"><code class="xref py py-obj docutils literal"><span class="pre">array_repr</span></code></a>还返回有关数组类型及其数据类型的信息。</span></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name">
<col class="field-body">
<tbody valign="top">
<tr class="field-odd field"><th class="field-name"><span class="yiyi-st" id="yiyi-17">参数：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-18"><strong>a</strong>：ndarray</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-19">输入数组。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-20"><strong>max_line_width</strong>：int，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-21">如果文字长度大于<em class="xref py py-obj">max_line_width</em>，则插入换行符。</span><span class="yiyi-st" id="yiyi-22">默认是，间接，75。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-23"><strong>precision</strong>：int，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-24">浮点精度。</span><span class="yiyi-st" id="yiyi-25">默认值是当前打印精度（通常为8），可以使用<a class="reference internal" href="numpy.set_printoptions.html#numpy.set_printoptions" title="numpy.set_printoptions"><code class="xref py py-obj docutils literal"><span class="pre">set_printoptions</span></code></a>更改。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-26"><strong>suppress_small</strong>：bool，可选</span></p>
<blockquote class="last">
<div><p><span class="yiyi-st" id="yiyi-27">将非常接近零的数字表示为零；默认为False。</span><span class="yiyi-st" id="yiyi-28">非常接近由精度定义：如果精度为8，例如，比5e-9小（绝对值）的数字被表示为零。</span></p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title"><span class="yiyi-st" id="yiyi-29">也可以看看</span></p>
<p class="last"><span class="yiyi-st" id="yiyi-30"><a class="reference internal" href="numpy.array2string.html#numpy.array2string" title="numpy.array2string"><code class="xref py py-obj docutils literal"><span class="pre">array2string</span></code></a>，<a class="reference internal" href="numpy.array_repr.html#numpy.array_repr" title="numpy.array_repr"><code class="xref py py-obj docutils literal"><span class="pre">array_repr</span></code></a>，<a class="reference internal" href="numpy.set_printoptions.html#numpy.set_printoptions" title="numpy.set_printoptions"><code class="xref py py-obj docutils literal"><span class="pre">set_printoptions</span></code></a></span></p>
</div>
<p class="rubric"><span class="yiyi-st" id="yiyi-31">例子</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">array_str</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
<span class="go">&apos;[0 1 2]&apos;</span>
</pre></div>
</div>
</dd></dl>
